Skip to content

[#19] fix: 토큰 내부 claims로 travelItineraryId와 userId 파싱#21

Merged
chungjeongsu merged 1 commit into
developfrom
fix/secondary-token-auth
Apr 2, 2026
Merged

[#19] fix: 토큰 내부 claims로 travelItineraryId와 userId 파싱#21
chungjeongsu merged 1 commit into
developfrom
fix/secondary-token-auth

Conversation

@chungjeongsu

Copy link
Copy Markdown
Contributor

No description provided.

@chungjeongsu chungjeongsu self-assigned this Apr 2, 2026
@chungjeongsu chungjeongsu merged commit 8803c2a into develop Apr 2, 2026
2 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the SecondaryTokenAuthenticator to retrieve travelItineraryId from the payload instead of the request URL, removes the now-unused extractTravelDocId method, and updates the server log message accordingly. The reviewer suggested consolidating the validation logic for travelItineraryId to improve code conciseness and maintainability.

Comment on lines +43 to +60
const rawTravelDocId = payload?.travelItineraryId;
if (typeof rawTravelDocId !== "string" && typeof rawTravelDocId !== "number") {
return {
ok: false,
statusCode: 400,
message: "Missing travelItineraryId query parameter"
statusCode: 401,
message: "Secondary token must include travelItineraryId"
};
}

const userId = String(rawUserId);
const travelDocId = rawTravelDocId;
const travelDocId = String(rawTravelDocId).trim();
if (!travelDocId) {
return {
ok: false,
statusCode: 401,
message: "Secondary token must include travelItineraryId"
};
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

travelItineraryId에 대한 유효성 검사 로직이 두 부분으로 나뉘어 있어 중복이 발생하고 있습니다. 이 두 검사를 하나로 통합하여 코드를 더 간결하고 유지보수하기 쉽게 만들 수 있습니다.

    const rawTravelDocId = payload?.travelItineraryId;
    if (
      (typeof rawTravelDocId !== "string" && typeof rawTravelDocId !== "number") ||
      String(rawTravelDocId).trim() === ""
    ) {
      return {
        ok: false,
        statusCode: 401,
        message: "Secondary token must include travelItineraryId"
      };
    }

    const userId = String(rawUserId);
    const travelDocId = String(rawTravelDocId).trim();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant